﻿namespace TomatoBreak.Infrastructure
{
    using System;
    using System.Web.Mvc;

    public static class ModelBinderMappingHelper
    {
        public static TypeMappingRegistry<object, IModelBinder> Register<TModel, TModelBinder>(this TypeMappingRegistry<object, IModelBinder> instance) where TModelBinder : IModelBinder
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            instance.Register(typeof(TModel), typeof(TModelBinder));

            return instance;
        }
    }
}